package lab02.test34;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Test34 {
    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        list.add("apple");
        list.add("grape");
        list.add("banana");
        list.add("pear");

        Collections.sort(list);//排序


        System.out.println("最小的：" + list.get(0) + "最大的：" + list.get(3));
        System.out.println();
        System.out.println("排序结果为：");
        for (String n : list) {
            System.out.print(n + "    ");
        }
    }
}
